#-*- coding: utf-8 -*-
'''
Created on 13 nov. 2013

@author: Goz
'''

class ApiRouter(object):
    '''
    classdocs
    '''
    
    def db_for_read(self, model, **hints):
        if model._meta.app_label == 'dj_pses_parser':
            return 'dj_api'
        return None
    
    def db_for_write(self, model, **hints):
        if model._meta.app_label == 'dj_pses_parser':
            return 'dj_api'
        return None
    
    def allow_relation(self, obj1, obj2, **hints):
        if obj1._meta.app_label == 'dj_pses_parser' or  obj2._meta.app_label == 'dj_pses_parser':
            return True
        return None
    
    def allow_syncdb(self, db, model):
        if db == 'dj_api':
            return model._meta.app_label == 'dj_pses_parser'
        elif model._meta.app_label == 'dj_pses_parser':
            return False
        return None
    
        